// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    { 
      path: '/login', 
      name: 'login', 
      component: () => import('../views/login.vue') 
    },
    {
      path: '/index',
      name: 'index',
      component: () => import('../views/index.vue'),
      children: [
        { 
          path: 'welcome',
          name: 'welcome',
          component: () => import('../views/welcome.vue')
        },
        // 用户列表
        { 
          path: 'userAll',
          name: 'userAll', 
          component: () => import('../views/user/userAll.vue')
        },
        // 卖家资质审核
        {
          path: 'sellerQualificationAll',
          name: 'sellerQualificationAll',
          component: () => import('../views/user/sellerQualificationAll.vue')
        },
        // 业务员列表
        { 
          path: 'businessmanAll',
          name: 'businessmanAll',
          component: () => import('../views/businessman/businessmanAll.vue')
        },
        // 销售列表
        {
          path: 'businessmanXiaoShou',
          name: 'businessmanXiaoShou',
          component: () => import('../views/businessman/businessmanXiaoShou.vue')
        },
        // 设备列表
       { 
          path: 'equipmentAll',  // 路由路径
          name: 'equipmentAll',  // 路由名称
          component: () => import('../views/equipment/equipmentAll.vue')  // 对应组件路径
        },
        // 设备详情
        {
          path: 'equipmentDetail',
          name: 'equipmentDetail',
          component: () => import('../views/equipment/equipmentDetail.vue')
        },
        // 订单信息
        {
          path: 'equipmentOrder',
          name: 'equipmentOrder',
          component: () => import('../views/equipment/equipmentOrder.vue')
        },
        // 设备评估报告
        {
          path: 'detectionReportAll',
          name: 'detectionReportAll',
          component: () => import('../views/equipment/detectionReportAll.vue')
        },
        // 求购信息
        {
          path: 'purchaseInfo',
          name: 'purchaseInfo',
          component: () => import('../views/equipment/equipmentPurchaseInfo.vue')
        },
        // 文章列表
        {
          path: 'articleAll',
          name: 'articleAll',
          component: () => import('../views/article/articleAll.vue')
        },
        // 文章分类列表
        {
          path: 'articleCategoryAll',
          name: 'articleCategoryAll',
          component: () => import('../views/article/articleCategoryAll.vue')
        },
        // 角色列表
        { 
          path: 'role',
          name: 'role',
          component: () => import('../views/operator/role.vue')
        },
        // 操作员列表
        {
          path: 'operatorAll',
          name: 'operatorAll',
          component: () => import('../views/operator/operatorAll.vue')
        },



      ]
    },

    // { 
    //   path: '/home',
    //   name: 'home',
    //   component: () => import('../views/home.vue'),
    //   children: [
    //     {
    //       path: 'welcome',
    //       name: 'welcome',
    //       component: () => import('../views/welcome.vue')
    //     },
    //     { 
    //       path: 'userAll',
    //       name: 'userAll', 
    //       component: () => import('../views/user/userAll.vue')
    //     },
    //     // 新增设备列表路由
    //     { 
    //       path: 'equipmentAll',  // 路由路径
    //       name: 'equipmentAll',  // 路由名称
    //       component: () => import('../views/equipment/equipmentAll.vue')  // 对应组件路径
    //     },
    //     {
    //       path: 'equipmentDetail',
    //       name: 'equipmentDetail',
    //       component: () => import('../views/equipment/equipmentDetail.vue')
    //     },
    //     {
    //       path: 'equipmentEdit',
    //       name: 'equipmentEdit',
    //       component: () => import('../views/equipment/equipmentEdit.vue'),
    //       props: true  // 添加此行以启用路由参数作为组件属性传递
    //     },
    //     // 求购信息路由
    //     {
    //       path: 'purchaseInfo',
    //       name: 'purchaseInfo',
    //       component: () => import('../views/equipment/equipmentPurchaseInfo.vue')
    //     },
    //     // 订单管理路由
    //     {
    //       path: 'equipmentOrder',
    //       name: 'equipmentOrder',
    //       component: () => import('../views/equipment/equipmentOrder.vue')
    //     },
    //     // 设备评估报告路由
    //     {
    //       path: 'detectionReportAll',
    //       name: 'detectionReportAll',
    //       component: () => import('../views/equipment/detectionReportAll.vue')
    //     },
    //     {
    //       path: 'sellerQualificationAll',
    //       name: 'sellerQualificationAll',
    //       component: () => import('../views/user/sellerQualificationAll.vue')
    //     },
    //     { path: 'businessmanAll',name: 'businessmanAll', component: () => import('../views/businessman/businessmanAll.vue')},
    //     { path: 'articleAll',name: 'articleAll', component: () => import('../views/article/articleAll.vue')},
    //     { path: 'articleCategoryAll',name: 'articarticleCategoryAllleAll', component: () => import('../views/article/articleCategoryAll.vue')},
    //     { path: 'businessmanXiaoShou',name: 'businessmanXiaoShou', component: () => import('../views/businessman/businessmanXiaoShou.vue')},
    //     { path: 'role',name: 'role', component: () => import('../views/operator/role.vue')},
    //     { path: 'operatorAll',name: 'operatorAll', component: () => import('../views/operator/operatorAll.vue')},
    //   ]
    // }
  ]
})

export default router